﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Concordia.Models._Transactions;
using Concordia.ViewModels;

namespace Concordia.Controllers
{
    public class _TransactionsController : Controller
    {
        //
        // GET: /Transactions/

        public ActionResult TransactionsPanel()
        {

            //TODO:  Redirect login
            if (Session == null) return View();
            var vm = (AccountViewModel)Session["AccountViewModel"];

            var context = new _TransactionsContextDataContext();

            var startDate = vm.Now.Subtract(new TimeSpan(14, 0, 0, 0));
            var stopDate = vm.Now.Add(new TimeSpan(14, 0, 0, 0));

            IEnumerable<WEB_SEL_CS_MAIN_TRANSACT_HISTORYResult> result = context.WEB_SEL_CS_MAIN_TRANSACT_HISTORY(vm.LoanKey, startDate, stopDate);
            return View(result);
        }

    }
}
